package com.gxa.modules.sys.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.gxa.modules.sys.entity.Complaints;
import com.gxa.modules.sys.entity.ComplaintTypeAdd;
import com.gxa.modules.sys.entity.ComplaintTypeUpdate;
import com.gxa.modules.sys.mapper.ComplaintTypeMapper;
import com.gxa.modules.sys.service.ComplaintTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;
@Component
public class ComplaintTypeServiceImpl implements ComplaintTypeService {
    @Autowired
    private ComplaintTypeMapper complaintTypeMapper;
    @Override
    public PageInfo<Complaints> queryHouseLabel(Map<String, Object> params) {

        String page1=(String) params.get("page");
        String limit1=(String)params.get("limit");
        Integer page=Integer.valueOf(page1);
        Integer limit=Integer.valueOf(limit1);

        //条件查询
        String complaintType = (String) params.get("complaintType");

        PageHelper.startPage(page,limit);

        List<Complaints> complaintTypes = this.complaintTypeMapper.queryComplaintType(complaintType);

        PageInfo<Complaints> pageInfo = new PageInfo<>(complaintTypes);
        return pageInfo;
    }

    @Override
    public void addComplaintType(ComplaintTypeAdd complaintTypeAdd) {
        this.complaintTypeMapper.addComplaintType(complaintTypeAdd);
    }

    @Override
    public void updateComplaintType(ComplaintTypeUpdate complaintTypeUpdate) {
        this.complaintTypeMapper.updateComplaintType(complaintTypeUpdate);
    }

    @Override
    public void deleteComplaintType(Integer id) {
        this.complaintTypeMapper.deleteComplaintType(id);
    }
}
